# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

cc_library(
    name = "app_state_db_port_table_event",
    srcs = ["app_state_db_port_table_event.cc"],
    hdrs = ["app_state_db_port_table_event.h"],
    deps = [
        ":state_event_monitor",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@sonic_swss_common//:common",
    ],
)

cc_test(
    name = "app_state_db_port_table_event_test",
    srcs = ["app_state_db_port_table_event_test.cc"],
    deps = [
        ":app_state_db_port_table_event",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "app_state_db_send_to_ingress_port_table_event",
    srcs = ["app_state_db_send_to_ingress_port_table_event.cc"],
    hdrs = ["app_state_db_send_to_ingress_port_table_event.h"],
    deps = [
        ":state_event_monitor",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/p4runtime:packetio_helpers",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@sonic_swss_common//:common",
    ],
)

cc_test(
    name = "app_state_db_send_to_ingress_port_table_event_test",
    srcs = ["app_state_db_send_to_ingress_port_table_event_test.cc"],
    deps = [
        ":app_state_db_send_to_ingress_port_table_event",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "//p4rt_app/p4runtime:packetio_helpers",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
        "@sonic_swss_common//:common",
    ],
)

cc_library(
    name = "state_event_monitor",
    srcs = ["state_event_monitor.cc"],
    hdrs = ["state_event_monitor.h"],
    deps = [
        "//gutil/gutil:status",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:str_format",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_library(
    name = "state_verification_events",
    srcs = ["state_verification_events.cc"],
    hdrs = ["state_verification_events.h"],
    deps = [
        "//gutil/gutil:status",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/sonic/adapters:consumer_notifier_adapter",
        "//p4rt_app/sonic/adapters:table_adapter",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/time",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_library(
    name = "debug_data_dump_events",
    srcs = ["debug_data_dump_events.cc"],
    hdrs = ["debug_data_dump_events.h"],
    deps = [
        "//gutil/gutil:io",
        "//gutil/gutil:status",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/sonic/adapters:consumer_notifier_adapter",
        "//p4rt_app/sonic/adapters:notification_producer_adapter",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/synchronization",
        "@com_google_absl//absl/time",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_library(
    name = "config_db_queue_table_event",
    srcs = ["config_db_queue_table_event.cc"],
    hdrs = ["config_db_queue_table_event.h"],
    deps = [
        ":state_event_monitor",
        "//gutil/gutil:status",
        "//p4rt_app/p4runtime:p4runtime_impl",
	"//p4rt_app/p4runtime:queue_translator",
        "@com_google_absl//absl/status",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_test(
    name = "config_db_queue_table_event_test",
    srcs = ["config_db_queue_table_event_test.cc"],
    deps = [
        ":config_db_queue_table_event",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/p4runtime:queue_translator",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_library(
    name = "config_db_node_cfg_table_event",
    srcs = ["config_db_node_cfg_table_event.cc"],
    hdrs = ["config_db_node_cfg_table_event.h"],
    deps = [
        ":state_event_monitor",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_library(
    name = "config_db_port_table_event",
    srcs = ["config_db_port_table_event.cc"],
    hdrs = ["config_db_port_table_event.h"],
    deps = [
        ":state_event_monitor",
        "//gutil/gutil:status",
        "//p4rt_app/p4runtime:p4runtime_impl",
        "//p4rt_app/sonic:redis_connections",
        "//p4rt_app/sonic/adapters:table_adapter",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@sonic_swss_common//:common",
    ],
)

cc_test(
    name = "config_db_port_table_event_test",
    srcs = ["config_db_port_table_event_test.cc"],
    deps = [
        ":config_db_port_table_event",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "config_db_node_cfg_table_event_test",
    srcs = ["config_db_node_cfg_table_event_test.cc"],
    deps = [
        ":config_db_node_cfg_table_event",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_test(
    name = "state_verification_events_test",
    srcs = ["state_verification_events_test.cc"],
    deps = [
        ":state_verification_events",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "//p4rt_app/sonic/adapters:mock_consumer_notifier_adapter",
        "//p4rt_app/sonic/adapters:mock_table_adapter",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/synchronization",
        "@com_google_googletest//:gtest_main",
        "@sonic_swss_common//:libswsscommon",
    ],
)

cc_test(
    name = "debug_data_dump_events_test",
    srcs = ["debug_data_dump_events_test.cc"],
    deps = [
        ":debug_data_dump_events",
        "//gutil/gutil:io",
        "//gutil/gutil:status_matchers",
        "//p4rt_app/p4runtime:mock_p4runtime_impl",
        "//p4rt_app/sonic/adapters:mock_consumer_notifier_adapter",
        "//p4rt_app/sonic/adapters:mock_notification_producer_adapter",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/synchronization",
        "@com_google_googletest//:gtest_main",
        "@sonic_swss_common//:libswsscommon",
    ],
)
